import FormItem from "antd/es/form/FormItem";
import {TreeSelect} from "antd";
import {removeSetter} from "../../../utils/removeSetter.ts";
import {TreeSelectProps} from "./dev.tsx";


const TreeSelectProd = (props:TreeSelectProps) => {
    const {styles,treeData} = props;
    const ComponentProps = removeSetter({...props},["children","parentId"])


    return (
        <div style={styles} >
            <FormItem>
                <FormItem label={props.label} name={props.name} rules={props.rule} style={{margin: "0"}}>
                    <TreeSelect
                        showSearch
                        style={{ width: '100%' ,...styles}}
                        dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
                        placeholder="Please select"
                        treeData={treeData}
                        {...ComponentProps}
                    />
                </FormItem>
            </FormItem>
        </div>
    );
};

export default TreeSelectProd;